
import request from '@/utils/request'
import { baseUrl } from '@/config/env';

//获取商品服务列表列表
export const list = (page, size, params) => {
  	return request({
	    url: baseUrl+'/rest/productType/list',
	    method: 'get',
	    params: {
	      	page,
		    size,
		    ...params
	    }
  	})
}

//编辑商品服务类型
export const editProType = (data) => {
	return request({
		url: baseUrl+'/rest/productType/edit',
		method: 'post',
		data
	  })
}
//新增商品类型
export const addType = (data) => {
	return request({
	  url: baseUrl+'/rest/productType/edit',
	  method: 'post',
	  data
	})
}

//删除商品类型
export const delType = (id) => {
	return request({
	  url: `${baseUrl}/rest/productType/delete/${id}`,
	  method: 'get'
	})
}

//扩展属性列表
export const expandType = (typeId) => {
	return request({
	    url: `${baseUrl}/rest/productAttr/ext/list/?typeId=${typeId}`,
	    method: 'get'
  	})
}

//规格列表
export const specs = (typeId) => {
	return request({
	    url: `${baseUrl}/rest/productAttr/skuItem/list/?typeId=${typeId}`,
	    method: 'get',
  	})
}

// 添加扩展属性
export const addExpandAttr = (data) => {
	return request({
	    url: baseUrl+'/rest/productAttr/ext/edit',
		method: 'post',
		data
  	})
}
//添加规格  /rest/productAttr/skuItem/edit
export const addSpces = (data) => {
	return request({
		url: baseUrl+'/rest/productAttr/skuItem/edit',
		method: 'post',
		data
	})
}


//删除扩展属性
export const delExpandAttr = (id) => {
	console.log(id)
	return request({
	    url: `${baseUrl}/rest/productAttr/delete/${id}`,
	    method: 'get'
  	})
}


//删除扩展属性、规格
export const delExpandAttrValue = (id) => {
	return request({
	    url: `${baseUrl}/rest/productAttr/value/delete/${id}`,
	    method: 'get'
  	})
}

// 扩展属性、规格 添加/修改值
export const addExpandAttrValue = (data) => {
	return request({
	    url: baseUrl+'/rest/productAttr/value/add',
		method: 'post',
		data
  	})
}

